<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      /* 必须设置高度，100%是无法垂直居中的 这就牵扯到CSS中的流了 */
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      /* 可以设置主轴为垂直方向 垂轴会垂直于主轴 */
      flex-direction: column;
    }

    img {
      height: 200px;
      width: 200px;
      border: antiquewhite 1px solid;
    }
  </style>
</head>

<body>
  <div>
    <img
      src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1602213689629&di=50ea1edf5980faee4164b5da8deac9d6&imgtype=0&src=http%3A%2F%2Fcdn.duitang.com%2Fuploads%2Fitem%2F201409%2F06%2F20140906201400_rEyEt.jpeg"
      alt="芒果">
  </div>
</body>

</html>